package cn.com.nes.mybatis.agent.system.entity;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 抖音用户信息表
 * </p>
 *
 * @author nes
 * @since 2022-08-24
 */
@TableName("user_douyin")
public class UserDouyin extends Model<UserDouyin> {

    private static final long serialVersionUID = 1L;

    /**
     * 抖音用户唯一标识
     */
    @TableId(value = "open_id", type = IdType.INPUT)
    private String openId;
    /**
     * 性别：0-未知，1-男性，2-女性
     */
    private Byte gender;
    /**
     * 抖音昵称
     */
    private String nickname;
    /**
     * 头像地址
     */
    private String avatar;
    /**
     * 国家
     */
    private String country;
    /**
     * 省份
     */
    private String province;
    /**
     * 城市
     */
    private String city;
    /**
     * 企业用户类型：EAccountM-普通企业号，EAccountS-认证企业号，EAccountK-品牌企业号
     */
    @TableField("e_account_role")
    private String eAccountRole;
    /**
     * 用户在当前开发者账号下的唯一标识（未绑定开发者账号没有该字段）
     */
    @TableField("union_id")
    private String unionId;
    /**
     * 创建时间
     */
    @TableField("createTime")
    private Date createTime;
    /**
     * 创建者uid
     */
    @TableField("createUid")
    private Long createUid;
    /**
     * 修改者uid
     */
    @TableField("modifyUid")
    private Long modifyUid;
    /**
     * 修改时间
     */
    @TableField("modifyTime")
    private Date modifyTime;
    /**
     * 是否删除:1:表示删除，0:表示未删除
     */
    private Integer sfsc;

    public UserDouyin() {
    }

    public UserDouyin(JSONObject data) {
        this.openId = data.getString("open_id");
        this.nickname = data.getString("nickname");
        this.avatar = data.getString("avatar");
        this.country = data.getString("country");
        this.city = data.getString("city");
        this.province = data.getString("province");
        this.gender = data.getByte("gender");
        this.eAccountRole = data.getString("e_account_role");
        this.unionId = data.getString("union_id");
    }

    public void setCreateInfo(Long userId, Date operateTime) {
        setCreateUid(userId);
        setCreateTime(operateTime);
        setModifyUid(userId);
        setModifyTime(operateTime);
    }

    public void setModifyInfo(Long userId, Date operateTime) {
        setModifyUid(userId);
        setModifyTime(operateTime);
    }

    public Byte getGender() {
        return gender;
    }

    public void setGender(Byte gender) {
        this.gender = gender;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String geteAccountRole() {
        return eAccountRole;
    }

    public void seteAccountRole(String eAccountRole) {
        this.eAccountRole = eAccountRole;
    }

    public String getUnionId() {
        return unionId;
    }

    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Long getCreateUid() {
        return createUid;
    }

    public void setCreateUid(Long createUid) {
        this.createUid = createUid;
    }

    public Long getModifyUid() {
        return modifyUid;
    }

    public void setModifyUid(Long modifyUid) {
        this.modifyUid = modifyUid;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public Integer getSfsc() {
        return sfsc;
    }

    public void setSfsc(Integer sfsc) {
        this.sfsc = sfsc;
    }

    public static final String ID = "id";

    public static final String GENDER = "gender";

    public static final String NICKNAME = "nickname";

    public static final String OPEN_ID = "open_id";

    public static final String AVATAR = "avatar";

    public static final String COUNTRY = "country";

    public static final String PROVINCE = "province";

    public static final String CITY = "city";

    public static final String E_ACCOUNT_ROLE = "e_account_role";

    public static final String UNION_ID = "union_id";

    public static final String CREATETIME = "createTime";

    public static final String CREATEUID = "createUid";

    public static final String MODIFYUID = "modifyUid";

    public static final String MODIFYTIME = "modifyTime";

    public static final String SFSC = "sfsc";

    @Override
    public Serializable pkVal() {
        return this.openId;
    }

    @Override
    public String toString() {
        return "UserDouyin{" +
                ", openId=" + openId +
                ", gender=" + gender +
                ", nickname=" + nickname +
                ", avatar=" + avatar +
                ", country=" + country +
                ", province=" + province +
                ", city=" + city +
                ", eAccountRole=" + eAccountRole +
                ", unionId=" + unionId +
                ", createTime=" + createTime +
                ", createUid=" + createUid +
                ", modifyUid=" + modifyUid +
                ", modifyTime=" + modifyTime +
                ", sfsc=" + sfsc +
                "}";
    }
}
